From: Florian Müllner Date: Sat, 20 Feb 2021 12:33:29 +0000 (+0100) Subject: workspacesView: Center extra workspace X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~216 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=40121bbe4b6534bf1efb12ea8a9cd56b968af7aa;p=gnome-shell.git workspacesView: Center extra workspace At the moment views on non-primary monitors take up the entire work area, so simply allocating the available size works. However we'll soon shrink the views a bit to match the visuals on the primary monitor. As workspaces keep the ratio, reducing their height will also reduce the width; override the default allocate() to keep the extra workspace horizontally centered. Part-of: --- diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index fb9eafb0a..b65d88724 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -560,6 +560,18 @@ class ExtraWorkspaceView extends WorkspacesViewBase { this._workspace.stateAdjustment.value = progress; } + vfunc_allocate(box) { + this.set_allocation(box); + + const [width, height] = box.get_size(); + const [, childWidth] = this._workspace.get_preferred_width(height); + + const childBox = new Clutter.ActorBox(); + childBox.set_origin(Math.round((width - childWidth) / 2), 0); + childBox.set_size(childWidth, height); + this._workspace.allocate(childBox); + } + getActiveWorkspace() { return this._workspace; }